<template>
  <div class="rights">
    <!-- 面包屑导航区域 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/home' }">权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <!-- 卡片视图 -->
    <el-card class="box-card">
      <!-- 表格区域 -->
      <el-table :data="rightsList" style="width: 100%" border stripe>
        <el-table-column type="index" label="ID"> </el-table-column>
        <el-table-column prop="authName" label="权限" width="180">
        </el-table-column>
        <el-table-column prop="path" label="路径" width="180">
        </el-table-column>
        <el-table-column prop="level" label="权限等级" width="180">
          <template v-slot:default="scope">
            <el-tag type="danger" v-if="scope.row.level==0">一级</el-tag>
            <el-tag type="success" v-if="scope.row.level==1">二级</el-tag>
            <el-tag type="warning" v-if="scope.row.level==2">三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
      
    </el-card>
  </div>
</template>

<script>
import { getRightsList } from "@/network/power.js";
export default {
  name: "rights",
  data() {
    return {
      rightsList: [], //权限列表数据
    };
  },
  methods: {
    //获取权限列表
    async getRightsList() {
      const { data: res } = await getRightsList('list');
      if (res.meta.status !== 200) {
        return this.$messgae.error("获取权限列表失败");
      } else {
        this.rightsList = res.data;
        //  console.log(this.rightsList)
      }
    },
  },
  async created() {
    this.getRightsList('list');
  },
};
</script>

<style lang="less" scoped>
.rights{
    width: 100%;
}


.el-table {
  margin: 15px 0;
  width: 100%;
}





</style>
